package design.pattern.observer.jdk;

import org.junit.Test;

import java.util.Observable;

/**
 * @author futao
 * Created on 2017/11/27 - 19:57.
 * 被观察者
 */
public class UserAction extends Observable{
    public void login(UserBean userBean){
        System.out.println("用户登录");

        setChanged();
        /**
         * 通知观察者
         */
        notifyObservers(userBean);
    }
    @Test
    public void t(){
        UserAction userAction=new UserAction();
        new DbAdmin(userAction);
        userAction.login(new UserBean("NiuBist"));
    }
}
